import { createStore } from 'vuex'

export default createStore({
    state: {
        palylist: [],
        playCurrentIndex: 0,
        user: {
            islogin: false,
            username: 'not login'
        }
    },
    mutations: {
        setPlaylist: function (state, value) {
            state.playlist = value;
        },
        async phoneLogin(payload) {
            // console.log(payload)
            let result = await phoneLogin(payload.phone, payload.password)
            // console.log(result)
            return result;
        },
        setUser(state, value) {

        }
    },
    actions: {
        // async phoneLogin(payload) {
        //     console.log(payload)
        //     let result = await phoneLogin(payload.phone, payload.password)
        //     if (result.data.code === 200) {
        //         content.state.user.isLogin = true
        //         content.commit('setUser', state.user.isLogin)
        //     }
        //     console.log(result)
        //     return result;
        // }
    },
    modules: {

    }
})